import React from 'react';
import withRouter from '../../router/withRouter'
import axios from 'axios';
import './Room.scss'


class Room extends React.Component {
    componentDidMount() {
        let { search } = this.props;
        let id = search.get("id")
        axios.get(`/douyu/api/RoomApi/room/${id}`)
            .then((res) => {
                this.setState({
                    room: res.data.data
                })
            })
    }
    state = {
        room: null
    }

    render() {
        let { room } = this.state;
        console.log(room);
        return (
            <div className='room'>
                {room !== null &&
                    <div>
                        <img src={room.avatar} alt="" />
                        <p>{room.owner_name}</p>
                        <p>{room.room_name}</p>
                        <p>{room.start_time}</p>
                    </div>
                }
            </div>
        )
    }
}
export default withRouter(Room)